package com.codingfuture.service.impl;

import com.codingfuture.entity.Question;
import com.codingfuture.mapper.QuestionMapper;
import com.codingfuture.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl implements QuestionService {
    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public List<Question> list() {
        return questionMapper.findAll();
    }

    @Override
    public int add(Question question) {
        question.setType("1");
        return questionMapper.insert(question);
    }

    @Override
    public int deleteById(Integer id) {
        return questionMapper.deleteById(id);
    }

    @Override
    public int updateById(Question question) {
        return questionMapper.updateById(question);
    }
}
